<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>购物车</title>
    <link rel="stylesheet" href="/shop/shop.css" />

</head>
<body>
    <div class="container">
        <?php
            require_once("userTip.php");
        ?>
        <table class="cart" >
            <thead>
                <tr>
                    <td>商品名称</td>
                    <td>图片</td>
                    <td>单价</td>
                    <td>数量</td>
                    <td>小计</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
            <?php
                $cart = $_SESSION["cart"];
                foreach ($cart as $key => $p) {
                    echo "<tr>
                        <td>{$p['p_name']}</td>
                        <td>
                            <img src=\"{$p['p_image_url']}\" alt=\"no image\">
                        </td>
                        <td>
                            ￥ {$p['p_price']}
                        </td>
                        <td class=\"cart-ac1\" >
                            <a href=\"/shop/modifyNum.php?type=-1&pid={$p['p_id']}\">-</a>
                            <input type=\"text\" value=\"{$p['num']}\" readonly >
                            <a href=\"/shop/modifyNum.php?type=1&pid={$p['p_id']}\">+</a>
                        </td>
                        <td>
                            ￥ {$p['total']}
                        </td>
                        <td class=\"cart-ac2\" >
                            <a href=\"/shop/removeFromCart.php?pid={$p['p_id']}\">删除</a>
                        </td>
                    </tr>";
                }
            ?>
            </tbody>
        </table>
        <div>
            <a href="/shop/doOrder.php">下单</a>
        </div>
    </div>
</body>
</html>